import request from '/@/utils/request';

/**
 * 角色操作接口
 * @method getAdminMenu 获取后端动态路由菜单(admin)
 * @method getTestMenu 获取后端动态路由菜单(test)
 */
export function useRoleApi() {
	return {
		getRolePage: (data={}) => {
			return request<any, AjaxResult>({
				url: '/role/Page',
				method: 'post',
				data,
			});
		},
		getRoleList: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/role/List',
				method: 'get',
				params,
			});
		},
		addRole: (data={}) => {
			return request<any, AjaxResult>({
				url: '/role/Add',
				method: 'post',
				data,
			});
		},
		editRole: (data={}) => {
			return request<any, AjaxResult>({
				url: '/role/Update',
				method: 'post',
				data,
			});
		},
		getRoleMenuIds: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/role/OwnMenuList',
				method: 'get',
				params,
			});
		},
		getRoleOrgIds: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/role/OwnOrgList',
				method: 'get',
				params,
			});
		},
		editRoleOrgIds: (data={}) => {
			return request<any, AjaxResult>({
				url: '/role/GrantDataScope',
				method: 'post',
				data,
			});
		},
	};
}
